<template>
  <a-select
    show-search
    :disabled="disabled"
    placeholder="请选择审计负责人"
    option-filter-prop="children"
    style="width: 220px"
    v-model="subValue"
    @change="changeSelect"
  >
    <a-select-option v-for='(item,index) in fzrList' :key='item.id' :value="item.id">
      {{item.realname}}
    </a-select-option>
  </a-select>
</template>

<script>
  import {getAction} from '@/api/manage'

  export default {
    name: 'fzrSelect',
    props: {
      disabled: {
        type: Boolean,
        default: () => {
          return false
        }
      },
      value: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        subValue: '',
        fzrList: [],//审批人列表
        url: {
          fzrList: '/sys/user/queryAuditInfoByOrgCode',
        },
      }
    },
    created() {
      this.getFzrList()
    },
    watch: {
      value: {
        handler: function (val) {
          this.subValue = val
        },
        immediate: true,
        deep: true
      }
    },
    methods: {
      //获取审核人列表
      changeSelect(val) {
        this.$emit('input', val)
      },
      getFzrList() {
        getAction(this.url.fzrList).then((res) => {
          if (res.success && res.result) {
            this.fzrList = res.result
          } else {
            console.log(res)
          }
        }).finally(() => {
        })
      },
    }
  }
</script>
<style scoped>
</style>
